function act() {
    var a = cm.getNumberFromQuestInfo(63090, "DnN");
    if (a == 0) {
        var e = cm.addNumberForQuestInfo(63091, "SunState", -1, 0, 9);
        cm.afterlandChangeMapObject("SunObj" + (e + 1), 1, 0, 0, 0, 0, 0, 0)
    } else {
        if (cm.getQuestStatus(63037) == 0 || cm.isQuestFinished(63059) && !cm.isQuestFinished(63060) || cm.getQuestStatus(63061) > 0 && cm.getQuestStatus(63062) == 0) {
            cm.openScriptNpc();
            return
        }
        var e = cm.addNumberForQuestInfo(63091, "SunState", 1, 0, 9);
        cm.afterlandChangeMapObject("SunObj" + (e - 1), 1, 0, 0, 0, 0, 0, 0)
    }
    cm.afterlandChangeMapObject("SunObj" + e, 1, 1, 0, 0, 0, 0, 0);
    if (e == 0) {
        cm.gainSkillBuff(2023633);
        cm.playerMessage(5, "夜之气息缠绕全身，体力与恢复能力提高了。");
        cm.forceStartQuest(63092, "");
        cm.setNumberForQuestInfo(63090, "DnN", 1);
        cm.addNumberForQuestInfo(63260, "DnN", 1);
        cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/RotationBack", 128);
        var b = cm.getNumberFromQuestInfo(63090, "raining") == 1;
        var d = cm.getNumberFromQuestInfo(63090, "lightning") == 1;
        var c = b || d;
        cm.updateInfoQuest(63095, "angle=" + (c ? 180 : -90));
        cm.afterlandChangeMapObject("RotationBack", 0, 0, 0, 1, c ? -90 : 90, 100, 1);
        if (d) {
            cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_lig_on", 100)
        } else {
            if (b) {
                cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_rai_on", 100)
            } else {
                cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_cle_on", 100)
            }
        }
        cm.afterlandUpdateEnvironment();
        cm.openScriptNpc()
    } else {
        if (e == 9) {
            cm.dispelBuff(2023633);
            cm.forceForfeitQuest(63092);
            cm.setNumberForQuestInfo(63090, "DnN", 0);
            cm.addNumberForQuestInfo(63260, "DnN", 1);
            cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/RotationBack", 128);
            var b = cm.getNumberFromQuestInfo(63090, "raining") == 1;
            var d = cm.getNumberFromQuestInfo(63090, "lightning") == 1;
            var c = b || d;
            cm.updateInfoQuest(63095, "angle=" + (c ? 0 : 90));
            cm.afterlandChangeMapObject("RotationBack", 0, 0, 0, 1, c ? 90 : -90, 100, 1);
            if (d) {
                cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_lig_on", 100)
            } else {
                if (b) {
                    cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_rai_on", 100)
                } else {
                    cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/PL_AfterLand/lamp_cle_on", 100)
                }
            }
            cm.afterlandUpdateEnvironment();
            cm.openScriptNpc()
        }
    }
}
var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(c, b, a) {
    if (cm.isQuestFinished(63028) && cm.getQuestStatus(63037) == 0) {
        cm.sendNormalTalk("#b(先和居民们对话，了解此地和太阳滑轮之后，再操作滑轮吧。)", 2, 0, false, false);
        cm.dispose()
    } else {
        if (cm.isQuestFinished(63059) && !cm.isQuestFinished(63060)) {
            cm.sendNormalTalk("#b(先趁着黑夜多消灭一些怪物吧。)", 2, 0, false, false);
            cm.dispose()
        } else {
            if (cm.getQuestStatus(63061) > 0 && cm.getQuestStatus(63062) == 0) {
                cm.sendNormalTalk("#b(这次让居民们多休息一会吧。先不升起太阳了。)", 2, 0, false, false);
                cm.dispose()
            } else {
                if (cm.getNumberFromQuestInfo(63091, "SunState") == 0) {
                    action1(c, b, a)
                } else {
                    action2(c, b, a)
                }
            }
        }
    }
}

function action1(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false, true);
            cm.inGameDirectionEvent_AskAnswerTime(9000)
        } else {
            if (status === a++) {
                cm.dispose();
                if (!cm.isQuestFinished(63028)) {
                    cm.warp(867113206, 1, true)
                } else {
                    if (cm.isQuestActive(63059)) {
                        cm.warp(867113205, 1, true)
                    } else {
                        cm.setInGameDirectionMode(false, true, false)
                    }
                }
                if (cm.getQuestStatus(63061) > 0 && cm.getQuestStatus(63062) == 0) {
                    cm.sendNormalTalk("#b(这次让居民们多休息一会吧。先不升起太阳了。)", 2, 0, false, false)
                }
            }
        }
    }
}

function action2(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false, true);
            cm.inGameDirectionEvent_AskAnswerTime(9000)
        } else {
            if (status === a++) {
                if (cm.isQuestFinished(63060) && cm.getQuestStatus(63061) == 0) {
                    cm.warp(867113207, 1, true);
                    cm.dispose();
                    return
                }
                cm.askMenu("今天你想执行哪个最强勇士战斗使命？#b\r\n#L0##b求生战#l\r\n#L1##b讨伐怪物#l\r\n#L2##b收集战利品#l", 5, 9400205)
            } else {
                if (status === a++) {
                    if (selectionLog[2] == 0) {
                        cm.askYesNo("你要通过#e求生战#n来选出最强勇士吗？\r\n击败所有敌人，生存到最后的人，就将成为今天的最强勇士。", 5, 9400205)
                    } else {
                        if (selectionLog[2] == 1) {
                            cm.askYesNo("你要通过#e讨伐怪物#n来选出最强勇士吗？\r\n最先在村庄外消灭25只#o9402052#和25只#o9402053#的勇士将成为最强勇士。", 5, 9400205)
                        } else {
                            cm.askYesNo("你要通过#e收集战利品#n来选出最强勇士吗？\r\n通过狩猎怪物最先收集到30个勇士证物的人将成为最强勇士。", 5, 9400205)
                        }
                    }
                } else {
                    if (status === a++) {
                        cm.sendNormalTalk("好。那现在开始！", 5, 9400205, false, true)
                    } else {
                        if (status === a++) {
                            cm.setInGameDirectionMode(false, true, false);
                            cm.setNumberForQuestInfo(63091, "BestWarrior", 0);
                            cm.playerMessage(5, "为了操作滑轮，我必须成为“最强勇士”。去完成当前进行中的战斗使命吧。");
                            cm.dispose();
                            if (selectionLog[2] == 0) {
                                cm.forceStartQuest(63034, "");
                                cm.openNpc("异逝界_勇士之地挑战")
                            } else {
                                if (selectionLog[2] == 1) {
                                    cm.forceStartQuest(63035, "")
                                } else {
                                    cm.forceStartQuest(63036, "")
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};